package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotate.AuotFill;
import com.sky.dto.CategoryDTO;
import com.sky.dto.CategoryPageQueryDTO;
import com.sky.entity.Category;
import com.sky.enumeration.OperationType;
import com.sky.result.Result;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CategoryMapper {

    @AuotFill(OperationType.INSERT)
    @Insert("insert into category(type,name,sort,status,create_time,update_time,create_user,update_user)" +
            "values (#{type},#{name},#{sort},#{status},#{createTime},#{updateTime},#{createUser},#{updateUser})")
    public void AddCategory(Category category);

    public Page<Category> GetPage(CategoryPageQueryDTO categoryPageQueryDTO);

    @Delete("delete from category where id =#{id}")
    public void DeleteById(Integer id);


    @AuotFill(OperationType.UPDATE)
    public void Update(Category categoryDTO);


    public List<Category> getType(Integer type);

    @Select("select * from category where id=#{id}")
    public Category getById(Long id);


}
